package models;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import play.db.jpa.Model;

/**
 * 实体类 - 栏目管理类
 * */
@Entity
@Table(name="programa")
public class Programa extends Model{

	@OneToMany(mappedBy="programa",cascade=CascadeType.REMOVE)
	public Set<News> news = new HashSet<News>();
	@OneToMany(mappedBy="programa",cascade=CascadeType.REMOVE)
	public Set<Information> informations = new HashSet<Information>();
	//@OneToMany(mappedBy="pro",cascade=CascadeType.REMOVE)
	@OneToMany(mappedBy="pro")
	public Set<Programa> programas = new HashSet<Programa>();
	@ManyToOne
	@JoinColumn(name="pro_id")
	public Programa pro;
	@Column(name="pro_name",length=50)
	public String proName;                              //栏目名称
	@Column(name="pro_path",length=1000)
	public String proPath;                              //栏目路径
	@Column(name="pro_code")
	public String proCode;                              //信息代码
	
	public String toString(){
		return proName;
	}
}
